<!DOCTYPE html>
<html lang="en">
<head>
    <title>${header_name}</title>
    <meta charset="utf-8"/>
    <link rel="stylesheet" href="/odoo_report_bro/static/src/js/libs/ext/spectrum.css?v=1.0.1"/>
    <link rel="stylesheet" href="/odoo_report_bro/static/src/js/libs/reportbro.css?v=1.0.1"/>

    <script src="/odoo_report_bro/static/src/js/libs/ext/jquery.js?v=1.0.1"></script>
    <script src="/odoo_report_bro/static/src/js/libs/ext/spectrum.js?v=1.0.1"></script>
    <script src="/odoo_report_bro/static/src/js/libs/ext/autosize.js?v=1.0.1"></script>
    <script src="/odoo_report_bro/static/src/js/libs/ext/JsBarcode.all.min.js?v=1.0.1"></script>
    <script src="/odoo_report_bro/static/src/js/libs/reportbro.js?v=1.0.4"></script>
    <script type="text/javascript">

        function save_report_bro (val) {
            var report = $('#reportbro').reportBro('getReport');
            $.ajax({
                url: '/reportbro/report/save',
                type: 'POST',
                data: JSON.stringify({"report_data": JSON.stringify(report), "report_id": ${report_id}}),
                cache: false,
                processData: false,
                contentType:"json/application",
                dataType:"json",
                success: function (res) {
                    $('#reportbro').reportBro('setModified', false);
                    console.log(res)
                },
                error: function(jqXHR, textStatus, errorThrown) {
                    alert('saving report failed');
                }})
        }
        $(document).ready(function () {
            var report =${report_data |safe };
            var rb = $('#reportbro').reportBro({
                //remove reportServerUrl if you want to use the default report server for a quick start
                reportServerUrl: '/reportbro/report/run',
                menuShowButtonLabels: true,
                localeKey: 'zh_cn',
                 menuShowDebug: true,
                saveCallback: save_report_bro });
            $('#reportbro').reportBro('load', report);
        });
    </script>
</head>
<body>
<div id="reportbro"></div>
</body>
</html>
